﻿Imports System.Data
Imports System.Data.SqlClient
Public Class ThemNhanVien

    Private Sub ThemNhanVien_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim bang As DataTable = NhanVien_BUS.loadLoaiNhanVien()
        CmbLoaiNV.DataSource = bang
        CmbLoaiNV.DisplayMember = "TenloaiQL"
        CmbLoaiNV.ValueMember = "MaloaiQL"
    End Sub

    Private Sub BtnThem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnThem.Click
        Dim nhanvien As New NhanVien_DTO
        If TxtDiaChi.Text = "" Or TxtDienThoai.Text = "" Or TxtTenNhanVien.Text = "" Then
            MessageBox.Show("bạn hãy điền thông tin đầy đủ")
        Else
            nhanvien.MaLoaiQL = CmbLoaiNV.SelectedValue
            nhanvien.HoTenQL = TxtTenNhanVien.Text
            nhanvien.DienThoai = TxtDienThoai.Text
            nhanvien.DiaChi = TxtDiaChi.Text
            NhanVien_BUS.ThemNhanVien(nhanvien)
        End If
    End Sub

    Private Sub BtnThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnThoat.Click
        Me.Close()
    End Sub

    Private Sub CmbLoaiNV_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmbLoaiNV.SelectedIndexChanged

    End Sub
End Class